﻿using DslModeling = global::Microsoft.VisualStudio.Modeling;

namespace RecentRunes.ObjectDiagram
{
    public partial class ObjectShape
    {
        static string GetDisplayPropertyFromObjectForAttributesCompartment(DslModeling::ModelElement element)
        {
            var attribute = element as ObjectAttribute;
            if(attribute == null) return "not an attribute";
            if (string.IsNullOrEmpty(attribute.Type) && string.IsNullOrEmpty(attribute.Value)) return attribute.Name;
            if (string.IsNullOrEmpty(attribute.Type)) return string.Format("{0} = {1}", attribute.Name, attribute.Value);
            if (string.IsNullOrEmpty(attribute.Value)) return string.Format("{0} ({1})", attribute.Name, attribute.Type);
            return string.Format("{0} ({1}) = {2}", attribute.Name, attribute.Type, attribute.Value);
        }
    }
}
